<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('attraction_info', function (Blueprint $table) {
            $table->comment('信息资讯表');
            $table->bigIncrements('id');
            $table->string('title', 64)->nullable(false)->comment('标题');
            $table->longText('intro')->nullable(true)->comment('信息内容');
            $table->integer('group')->nullable(false)->comment('信息分组1活动2优惠3交通');
            $table->integer('type_id')->nullable(false)->comment('类型id');
            $table->integer('spot_id')->nullable(true)->comment('点位id');
            $table->string('cover_id', 64)->nullable(true)->comment('封面id');
            $table->integer('status')->nullable(false)->default(3)->comment('是否显示状态1正常2停止3时间字段决定,优先级高于时间控制');
            $table->integer('sort')->nullable(false)->default(100)->comment('排序');
            $table->dateTime('start_time')->nullable(false)->comment('开始时间');
            $table->dateTime('end_time')->nullable(false)->comment('结束时间');
            $table->json('extension')->comment('扩展信息');
            $table->index(['title', 'group', 'type_id', 'spot_id'], 'index_title_group_type_id_spot_id');
            $table->datetimes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('attraction_info');
    }
};
